<%= form_tag url_for(:controller => 'works', :action => 'search'), :class => 'search', :method => :get do %>
<fieldset>
  <legend>Search works</legend>
  <% unless @query %>
  <% @query ||= {} %>
  <% end %>
  <dl>
  <dt>
    <label for="refine_text"><%= ts('Full text') %>:</label>
    </dt><dd>
    <%= text_field_tag "query[text]", @query[:text], :id => 'refine_text' %>
    <%= link_to_help "work-search-text-help" %>
  </dd>
  <dt>
    <label for="refine_tag"><%= ts('Tag') %>:</label>
    </dt><dd>
    <%= text_field_tag "query[tag]", @query[:tag], :id => 'refine_tag' %>
    <%= link_to_help "work-search-text-help" %>
  </dd>
  <dt>
    <label for="refine_title"><%= ts('Title:') %>:</label>
    </dt><dd>
    <%= text_field_tag "query[title]", @query[:title], :id => 'refine_title' %>
    <%= link_to_help "work-search-text-help" %>
  </dd>
  <dt>
    <label for="refine_author"><%= ts('Author') %>:</label>
    </dt><dd>
    <%= text_field_tag "query[author]", @query[:author], :id => 'refine_author' %>
    <%= link_to_help "work-search-text-help" %>
  </dd>
  <dt>
    <label for="refine_word_count"><%= ts('Words') %>:</label>
    </dt><dd>
    <%= text_field_tag "query[words]", @query[:words], :id => 'refine_word_count' %>
    <%= link_to_help "work-search-numerical-help" %>
  </dd>
  <dt>
    <label for="refine_hit_count"><%= ts('Hits') %>:</label>
    </dt><dd>
    <%= text_field_tag "query[hits]", @query[:hits], :id => 'refine_hit_count' %>
    <%= link_to_help "work-search-numerical-help" %>
  </dd>
  <dt>
    <label for="refine_kudo_count"><%= ts('Kudos') %>:</label>
    </dt><dd>
    <%= text_field_tag "query[kudos]", @query[:kudos], :id => 'refine_kudo_count' %>
    <%= link_to_help "work-search-numerical-help" %>
  </dd>
  <dt>
    <label for="refine_revised_at"><%= ts('Date') %>:</label>
    </dt><dd>
    <%= text_field_tag "query[date]", @query[:date], :id => 'refine_revised_at' %>
    <%= link_to_help "work-search-date-help" %>
  </dd>
  <dt>
    <label for="refine_language"><%= ts('Language') %>:</label>
    </dt><dd>
    <%= select_tag "query[language]", "<option></option>".html_safe + options_from_collection_for_select(@languages, 'name', 'name', @query[:language].blank? ? @query[:language] : @query[:language].capitalize), :id => 'refine_language' %>
    <%= link_to_help "work-search-language-help" %>
  </dd>
  <dt>
    <label for="refine_bookmarked"><%= ts('Bookmarked') %>?</label>
  </dt>
  <dd>
    <%= check_box_tag "query[bookmarked]", false, !@query[:bookmarked].blank?, :id => 'refine_bookmarked' %>
    <%= link_to_help "work-search-bookmark-help" %>
  </dd>
  <dt>
    <label for="refine_recced"><%= ts('Recced') %>?</label>
  </dt>
  <dd>
    <%= check_box_tag "query[recced]", false, !@query[:recced].blank?, :id => 'refine_recced' %>
    <%= link_to_help "work-search-bookmark-help" %>
  </dd>
  </dl>
  <p class="submit">
    <%= submit_tag ts('Search works'), :class => 'button', :name => nil %>
  </p>
</fieldset>
<% end %>
